interface speedItem {
    resource_download: number,
    dom_parse: number,
    content_download: number,
    ttfb: number,
    ssl: number,
    tcp: number,
    dns_lookup: number,
    create_time: string,
    times: number
}


export function groupData(originData: speedItem[]) {
    if (!originData || originData.length === 0) {
        return null;
    }
    let dnsData = [],
        tcpData = [],
        sslData = [],
        ttfbData = [],
        contentData = [],
        domData = [],
        resourceData = [],
        timesData = [];
    let createTimeData = [];
    originData.forEach(item => {
        dnsData.push(item.dns_lookup);
        tcpData.push(item.tcp);
        sslData.push(item.ssl);
        ttfbData.push(item.ttfb);
        contentData.push(item.content_download);
        domData.push(item.dom_parse);
        resourceData.push(item.resource_download);
        timesData.push(item.times);
        createTimeData.push(new Date(item.create_time).toLocaleString('chinese', { hour12: false }))
    });
    return {
        dnsData, tcpData, sslData, ttfbData, contentData, domData, resourceData, timesData, createTimeData
    }
}